<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\massage\model;

class CouponAtvRecordList extends \app\BaseModel
{
    protected $name = "massage_service_coupon_atv_record_list";
    public function dataAdd($data)
    {
        $data["create_time"] = time();
        $res = $this->insert($data);
        return $res;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function shIng($cap_id)
    {
        $dis = ["cap_id" => $cap_id, "status" => 1];
        $count = $this->where($dis)->count();
        return $count;
    }
    public function dataList($dis, $page = 10)
    {
        $data = $this->alias("a")->join("massage_service_user_list b", "b.id = a.to_inv_id")->where($dis)->field("b.nickName,b.avatarUrl,b.id,a.create_time")->group("b.id")->paginate($page)->toArray();
        if(!empty($data["data"])) {
            foreach ($data["data"] as &$v) {
                $v["create_time"] = date("Y-m-d H:i:s", $v["create_time"]);
            }
        }
        return $data;
    }
    public function dataInfo($dis)
    {
        $data = $this->where($dis)->find();
        return !empty($data) ? $data->toArray() : [];
    }
}

?>